﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ExplainDIToKid
{
    public class Kid
    {
        private readonly IFoodSupplier _foodSupplier;

        public Kid(IFoodSupplier foodSupplier)
        {
            _foodSupplier = foodSupplier;
        }

        public void HaveAMeal()
        {
            var food = _foodSupplier.GetFood();
            //eat
        }
    }

    public class Kid2
    {
        public IFoodSupplier FoodSupplier { get; set; }

        public void HaveAMeal()
        {
            var food = FoodSupplier.GetFood();
            //eat
        }
    }
}
